<template>
  <div class="background">
    <Row :style="bodyHeightStyle" type="flex" justify="center" class="code-row-bg">
      <i-col span="12" style="text-align: center">

        <div style="width:100%; text-align: center; margin-top:75%; margin-bottom:20px;">
          <img src="../assets/logo.png" style="width:80%;"/>
        </div>

        <Select v-model="select_interview" placeholder="请选择哪一个面试">
          <Option v-for="item in interviewList" :value="item.interviewId" :key="item.interviewId">{{ item.interview_name }}</Option>
        </Select>

        <Select v-model="select_type" placeholder="请选择身份" style="margin-top:20px;">
          <Option value="1">我是HR</Option>
          <Option value="2">我是面试官</Option>
        </Select>

        <Button style="margin-top:20px;" type="primary" size="large" long @click="submitSelect">选择完毕</Button>
      </i-col>
    </Row>
  </div>
</template>
<script>
  import interviewApi from '../api/axios/interviewApi'


  export default {
    data () {
      return {
        bodyHeightStyle: 'height:' + window.innerHeight + 'px',
        select_interview: 0,
        select_type: '',
        interviewList: []
      }
    },
    methods: {
      submitSelect (){
        this.$store.commit('auth/updateInterviewIdMutation',this.select_interview);

        if (this.select_type === '1'){
          this.$router.push('/sign_in');
        }else if (this.select_type === '2'){
          this.$router.push('/interviewer');
        }
      }
    },
    created (){
      let that = this;
      interviewApi.getInterviewList({
        currentPage: null,
        pageSize: null
      },{
        success (res) {
          if (res.data.status === 200) {
            that.interviewList = res.data.data.list;

          }else {
            console.log("getInterviewList 请求失败" + res.data);
          }
        }
      })
    }
  }
</script>
<style>
  .background {
    background-image: url("../assets/background.png");
    background-size: 100% 100%;
  }
</style>
